# $Id: PKGBUILD 181936 2013-04-05 08:55:30Z svenstaro $
# Maintainer: Andrea Scarpino <andrea@archlinux.org>

pkgname=kdegames-kajongg
pkgver=4.10.2
pkgrel=1
pkgdesc="The ancient Chinese board game for 4 players"
url="http://kde.org/applications/games/kajongg/"
arch=('any')
license=('GPL' 'LGPL' 'FDL')
groups=('kde' 'kdegames')
depends=('kdebase-runtime' 'twisted' 'kdebindings-python2')
makedepends=('cmake' 'automoc4')
install=${pkgname}.install
source=("http://download.kde.org/stable/${pkgver}/src/kajongg-${pkgver}.tar.xz")
sha1sums=('efda22fb18c5cbf87975be2f96a89a7ece6a2b9e')

build() {
  mkdir build
  cd build
  cmake ../kajongg-${pkgver} \
    -DCMAKE_BUILD_TYPE=Release \
    -DKDE4_BUILD_TESTS=OFF \
    -DCMAKE_INSTALL_PREFIX=/usr \
    -DPYTHON_EXECUTABLE=/usr/bin/python2
  make
}

package() {
  cd build
  make DESTDIR="${pkgdir}" install

  # Fix the python shebang
  sed -i 's|#!/usr/bin/env python|#!/usr/bin/env python2|' \
    "${pkgdir}"/usr/share/apps/kajongg/{deferredutil,kajongg,kajonggserver,server}.py
}
